// ITI 1120 Fall 2006, Lab 8, Exercise 2 // Name: Diana Inkpen, 123456 /** * PROGRAM: a recursive algorithm to create an array containing the values 0 * to N-1. */ class CreateArray { public static void main (String[] args) { // DECLARE VARIABLES/DATA DICTIONARY int n; // GIVEN: The size of the array int[] a; // RESULT: The array to be created and filled. // PRINT OUT IDENTIFICATION INFORMATION System.out.println(); System.out.println("ITI 1120 Fall 2006, Lab 8, Exercise 2"); System.out.println("Name: Diana Inkpen, Student# 123456"); System.out.println(); // READ IN GIVENS System.out.print("Please enter the size of the array: "); n = ITI1120.readInt(); // BODY OF ALGORITHM a = createArray(n); // PRINT OUT RESULTS AND MODIFIEDS int i; // EXTRA: variable needed to print array System.out.print("The array is: "); for( i = 0; i < n; i++) { System.out.print(a[i] + " "); } System.out.println( ); } // If the 'main' method calls other algorithms, put the method(s) below. /** * METHOD: createArray * * * GIVENS: */ public static int[] createArray(int n) { /* Complete this method */ } /** * METHOD: fillArray * * * GIVENS: */ public static void initArray( int[] a, int n ) { /* Complete this method */ } }